How do I install packages like pandas or numpy to use it with my KS headless script? I was not able to find a way to do that.
You need an installation of the right python version and the setting to use the local python in the preferences.
Then you can call for the module in the script.
For example:
from collections.abc import Iterable
import math
import shutil
import subprocess
import ostry:
import configparser
except ImportError:
subprocess.call([“python”, “-m”, “pip”, “install”, “configparser”])
print(“Configparser installed”)
finally:
import configparsertry:
from PIL import Image
except ImportError:
subprocess.call([“python”, “-m”, “pip”, “install”, “Pillow”])
print(“Pillow installed”)
finally:
from PIL import Image
CheerEO
Marco
Here’s the answer of Perplexity AI attached as Word Doc:
Installing Packages like Pandas or NumPy for KeySh.docx (116.6 KB) export